<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">
	<style>
		.div-dialog-label{ width: 90px; float:left;}
	</style>
	<ui:composition template="/views/layout/main.xhtml">
		<ui:define name="conteudo">
			<h:form id="formPrincipal">
				<div id="divBtn" class="grid_18 div_48">
					<h:panelGroup id="pnlBtn">
						<p:commandButton widgetVar="btn_Novo" type="button" styleClass="add-notes" title="Cadastrar" onclick="dialogoCreate.show();">
							<p:ajax event="click" update="formCreate, formPrincipal, formEdit, formDesativar" listener="#{palavraChaveBean.setarNew}"/>  
						</p:commandButton>
						<p:commandButton id="btn_Editar" type="button" title="Editar" styleClass="edit-notes" onclick="dialogoEdit.show();" rendered="#{palavraChaveBean.selecionado}"/>
						<p:commandButton id="btn_Desativar" type="button" styleClass="disable-notes" title="Desativar" onclick="dialogoDesativar.show();" rendered="#{palavraChaveBean.selecionado}"/>
						<p:commandButton widgetVar="btn_Novo" styleClass="home" ajax="false" action="#{palavraChaveBean.goHome}" title="Home" />
					</h:panelGroup>
				</div>

				<div class="grid_18 titulo">Palavras Chave</div>

				<div class="grid_18">
					<p:messages id="message"/>
				</div>
				
				<div class="grid_18">
					<p:dataTable widgetVar="dataTablePalavraChave" 
								id="dataTablePalavraChave" 
								onRowUnselectUpdate="formPrincipal"
								rowUnselectListener="#{palavraChaveBean.onRowUnselect}"
								onRowSelectUpdate="formPrincipal:dataTablePalavraChave, formPrincipal:pnlBtn, formEdit, formDesativar"
								paginator="true"
								selection="#{palavraChaveBean.palavraChaveInstanceTemp}" 
								value="#{palavraChaveBean.palavraChaveList}" 
								selectionMode="single"
								var="pc" update="formPrincipal, formEdit, formDesativar"
								emptyMessage="Nenhum registro encontrado!" 
								rows="10">
						<p:column headerText="Palavras Chave" sortBy="#{pc.nome}">
				            <h:outputText value="#{pc.nome}" />  
				        </p:column> 
					</p:dataTable>
					<br/>	
				</div>
			</h:form>

			<!-- INCLUSAO DE OUTROS XHTMLs -->
			<ui:include src="/views/palavrasChave/_dialogosCRUD.xhtml" />
		</ui:define>
	</ui:composition>
</f:view>